-- card: 8998 from stack: in.3 -- bmap block id: 9242 -- flags: 4000 -- background id: 8327 -- name: XScrollBoxM ----- HyperTalk script ----- on Install get ChooseTargetStack() InstallResource XFCN,XScrollBoxM,it InstallResource DITL,XScrollBoxM,it InstallResource DLOG,XScrollBoxM,it end Install -- part 2 (field) -- low flags: 01 -- high flags: 4007 -- rect: left=383 top=58 right=286 bottom=490 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: scroller -- part 3 (button) -- low flags: 00 -- high flags: 8003 -- rect: left=76 top=298 right=320 bottom=176 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: XScrollBoxM ----- HyperTalk script ----- on mouseUp put "1,3,5" into initial get XScrollBoxM(initial,"Choose among these:",card field "scroller","Help") go this card if it is "Help" then answer "You pushed the 'Help' button." else if it is "cancel" then answer "You pushed the 'Cancel' button." else if it is empty then answer "You did not select anything." else put (the number of items in it div 2) into count if count is 1 then put "item" into itemWord else put "items" into itemWord answer "You chose" && count && itemWord & "." end if end mouseUp -- part 5 (field) -- low flags: 01 -- high flags: 2007 -- rect: left=18 top=32 right=286 bottom=384 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Documentation -- part contents for card part 2 ----- text ----- able baker charlie dog ernest fox gamma horse ice cream jumping jack flash knockwurst liver monkey no way, jose occularity penelope qwerty rapscallion salubrious twinkle toes underwhelmed vermin wascally wabbit yokel zenzational -- part contents for card part 5 ----- text ----- XScrollBoxM version 2.4 Roger Brown XScrollBoxM is a version HyperCard XFCN XScrollBox that allows the user to make multiple selections. The return value is an item list in the format: number,text,number,text,..number,text where number is the number of a selection text is the text of the selection with that number Selection can be made by: 1. double-clicking on a line. 2. single-clicking on a line, then pressing the OK button. 3. single-clicking on a line, then pressing the Return key. 4. typing the first letter(s) of a selection, then doing 1,2, or 3. (Note: type selection assumes that the lines are ordered alphabetically) 5. scrolling with up and down arrow keys, then doing 1,2 or 3. Multiple selection is made by holding down the shift key while clicking. If the Cancel button is pressed, the string "Cancel" is returned. It requires that the DITL and DLOG resources (1347) packaged with it are in the stack. The dialog is centered on the screen and sized to hold the width of the longest line and/or the prompt line, whichever is widest. It will not overrun the width of a Mac+ screen. INVOKING XScrollBoxM get XScrollBoxM(first,prompt,container,userButton) where first is a list of 1 or more default selections in the list - either numbers or an item list of text strings (0 if none). NOTE: the text must exactly match what is in the field! prompt is a string to prompt the user. This appears at the top of the dialog box. container is any hypercard container (field, variable), presumed to be multi-lined. UserButton is the name for an optional author specified button. If this button is pressed, its name is returned further processing by the script. EXAMPLE ex. get XScrollBoxM("1,2,3","Choose:",card field 1,"Help") if OK is pressed, returns : 1,text of line 1 of card field 1,2,text of line 2 of card field 1,3,ext of line 3 of card field 3 REVISION HISTORY 1.4 - start with XScrollBox 1.4 1.6 - multiple selection by command-shift 1.7 -- 6/5/88 multiple selection by shift only 1.8 - 5/12/89 fixed two selection by typing bugs and made source compatible with LSC 3.0. 2.0 - 9/9/89 SuperCard compatible, fixed bugs in typing-selection, and userButton string handling. First item is selected if there is no default and the user presses a cursor arrow key. One source for all 3 versions, control version with compiler variables. Compiles under THINK C ™ 4.0. 2.1 - 2/21/90 Puch of cancel button now returns "Cancel" string. Fixed some bugs in allocatin and use of return handle. 2.2 - 3/29/90 Correctly displays eight-bit characters. 2.3 - 3/30/90 added XScrollBoxML version 2.4 - 4/17/90 revived a feature that had disappeared: specifying the default selection in XScrollBox and XScrollBox F as a string rather than a number